//
//  ViewController.m
//  GCD定时器
//
//  Created by 崔博 on 2018/9/11.
//  Copyright © 2018年 崔博. All rights reserved.
//

#import "ViewController.h"
#import "Timers.h"
@interface ViewController ()
@property (nonatomic, strong) dispatch_source_t timer;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}


- (void)gcdTimer
{
    dispatch_queue_t queue = dispatch_get_main_queue();
    self.timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
    dispatch_source_set_timer(self.timer, DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC, 1 * NSEC_PER_SEC);
    dispatch_source_set_event_handler(self.timer, ^{
        NSLog(@"---我是循环");
    });
    dispatch_resume(self.timer);

}

@end
